package book;

/**
 * @create：2024-03-25-19:18
 * @description：书架
 */
public class BookList {
    private Book[] books;
    private int usedSize; // 记录当前书架上的实际存放的图书个数

    private static final int DEFAULT_SIZE = 4;
    public BookList() {
        this.books = new Book[DEFAULT_SIZE];
        //放好书
        this.books[0] = new Book("Java从入门到精通", "java", 100, "学习", 1);
        this.books[1] = new Book("C语言从入门到精通", "C", 150, "学习", 2);
        this.books[2] = new Book("C++从入门到精通", "C++", 200, "学习", 3);

        this.usedSize = 3;
    }

    public int getUsedSize() {
        return usedSize;
    }

    public void setUsedSize(int usedSize) {
        this.usedSize = usedSize;
    }
    public Book getBook(int pos) {
        return this.books[pos];
    }
    public void setBook(int pos, Book book) {
        this.books[pos] = book;
    }

    public Book[] getBooks() {
        return books;
    }
}
